using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SailHero.Soft.FrameWork.Models;

namespace SailHero.Soft.FrameWork.Mapping.AuthCodeDB
{
    public class Sys_UserInRoleMap : EntityTypeConfiguration<Sys_UserInRole>
    {
        public Sys_UserInRoleMap()
        {
            // Primary Key
            this.HasKey(t => new { t.RoleID, t.UserID });

            // Properties
            this.Property(t => t.RoleID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.UserID)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Sys_UserInRole");
            this.Property(t => t.RoleID).HasColumnName("RoleID");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.CreateDate).HasColumnName("CreateDate");
        }
    }
}
